menubutton: Remove align-widget property
authorFlorian Müllner <fmuellner@gnome.org>
Fri, 24 Jul 2020 11:39:38 +0000 (13:39 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Fri, 24 Jul 2020 11:55:06 +0000 (13:55 +0200)
The property has been unused since commit 8701e34f749. That was four
years ago, so it's safe to say that nobody has been missing it terribly.

docs/reference/gtk/gtk4-sections.txt
gtk/gtkmenubutton.c
gtk/gtkmenubutton.h

index 5f2355d83c2968d911eea7a5f1eda5d21873e57e..2881f94dbe0a4d88eaa4b836348ad683da8f284f 100644 (file)
@@ -2041,8 +2041,6 @@ gtk_menu_button_get_menu_model
 GtkArrowType
 gtk_menu_button_set_direction
 gtk_menu_button_get_direction
-gtk_menu_button_set_align_widget
-gtk_menu_button_get_align_widget
 gtk_menu_button_set_icon_name
 gtk_menu_button_get_icon_name
 gtk_menu_button_set_label
index b4e842f0b595fc366a9289416d3327e5da681c5c..9a8b854437c67e657fc3e80be5a98414f5d98dda 100644 (file)
@@ -146,7 +146,6 @@ struct _GtkMenuButton
   GDestroyNotify create_popup_destroy_notify;
 
   GtkWidget *label_widget;
-  GtkWidget *align_widget;
   GtkWidget *arrow_widget;
   GtkArrowType arrow_type;
 };
@@ -160,7 +159,6 @@ enum
 {
   PROP_0,
   PROP_MENU_MODEL,
-  PROP_ALIGN_WIDGET,
   PROP_DIRECTION,
   PROP_POPOVER,
   PROP_ICON_NAME,
@@ -189,9 +187,6 @@ gtk_menu_button_set_property (GObject      *object,
       case PROP_MENU_MODEL:
         gtk_menu_button_set_menu_model (self, g_value_get_object (value));
         break;
-      case PROP_ALIGN_WIDGET:
-        gtk_menu_button_set_align_widget (self, g_value_get_object (value));
-        break;
       case PROP_DIRECTION:
         gtk_menu_button_set_direction (self, g_value_get_enum (value));
         break;
@@ -228,9 +223,6 @@ gtk_menu_button_get_property (GObject    *object,
       case PROP_MENU_MODEL:
         g_value_set_object (value, self->model);
         break;
-      case PROP_ALIGN_WIDGET:
-        g_value_set_object (value, self->align_widget);
-        break;
       case PROP_DIRECTION:
         g_value_set_enum (value, self->arrow_type);
         break;
@@ -372,18 +364,6 @@ gtk_menu_button_class_init (GtkMenuButtonClass *klass)
                            G_TYPE_MENU_MODEL,
                            GTK_PARAM_READWRITE);
 
-  /**
-   * GtkMenuButton:align-widget:
-   *
-   * The #GtkWidget to use to align the menu with.
-   */
-  menu_button_props[PROP_ALIGN_WIDGET] =
-      g_param_spec_object ("align-widget",
-                           P_("Align with"),
-                           P_("The parent widget which the menu should align with."),
-                           GTK_TYPE_WIDGET,
-                           GTK_PARAM_READWRITE);
-
   /**
    * GtkMenuButton:direction:
    *
@@ -588,64 +568,6 @@ gtk_menu_button_get_menu_model (GtkMenuButton *menu_button)
   return menu_button->model;
 }
 
-static void
-set_align_widget_pointer (GtkMenuButton *self,
-                          GtkWidget     *align_widget)
-{
-  if (self->align_widget)
-    g_object_remove_weak_pointer (G_OBJECT (self->align_widget), (gpointer *) &self->align_widget);
-
-  self->align_widget = align_widget;
-
-  if (self->align_widget)
-    g_object_add_weak_pointer (G_OBJECT (self->align_widget), (gpointer *) &self->align_widget);
-}
-
-/**
- * gtk_menu_button_set_align_widget:
- * @menu_button: a #GtkMenuButton
- * @align_widget: (allow-none): a #GtkWidget
- *
- * Sets the #GtkWidget to use to line the menu with when popped up.
- * Note that the @align_widget must contain the #GtkMenuButton itself.
- *
- * Setting it to %NULL means that the menu will be aligned with the
- * button itself.
- *
- * Note that this property is only used with menus currently,
- * and not for popovers.
- */
-void
-gtk_menu_button_set_align_widget (GtkMenuButton *menu_button,
-                                  GtkWidget     *align_widget)
-{
-  g_return_if_fail (GTK_IS_MENU_BUTTON (menu_button));
-  g_return_if_fail (align_widget == NULL || gtk_widget_is_ancestor (GTK_WIDGET (menu_button), align_widget));
-
-  if (menu_button->align_widget == align_widget)
-    return;
-
-  set_align_widget_pointer (menu_button, align_widget);
-
-  g_object_notify_by_pspec (G_OBJECT (menu_button), menu_button_props[PROP_ALIGN_WIDGET]);
-}
-
-/**
- * gtk_menu_button_get_align_widget:
- * @menu_button: a #GtkMenuButton
- *
- * Returns the parent #GtkWidget to use to line up with menu.
- *
- * Returns: (nullable) (transfer none): a #GtkWidget value or %NULL
- */
-GtkWidget *
-gtk_menu_button_get_align_widget (GtkMenuButton *menu_button)
-{
-  g_return_val_if_fail (GTK_IS_MENU_BUTTON (menu_button), NULL);
-
-  return menu_button->align_widget;
-}
-
 static void
 update_popover_direction (GtkMenuButton *self)
 {
@@ -746,8 +668,6 @@ gtk_menu_button_dispose (GObject *object)
       self->popover = NULL;
     }
 
-  set_align_widget_pointer (GTK_MENU_BUTTON (object), NULL);
-
   g_clear_object (&self->model);
   g_clear_pointer (&self->button, gtk_widget_unparent);
 
index b51e2b32376ec986ca2dd77c74af992225db8844..6f67ad393a49cf221388d98e7102ee6b5e93ef4b 100644 (file)
@@ -70,12 +70,6 @@ void         gtk_menu_button_set_menu_model (GtkMenuButton *menu_button,
 GDK_AVAILABLE_IN_ALL
 GMenuModel  *gtk_menu_button_get_menu_model (GtkMenuButton *menu_button);
 
-GDK_AVAILABLE_IN_ALL
-void         gtk_menu_button_set_align_widget (GtkMenuButton *menu_button,
-                                               GtkWidget     *align_widget);
-GDK_AVAILABLE_IN_ALL
-GtkWidget   *gtk_menu_button_get_align_widget (GtkMenuButton *menu_button);
-
 GDK_AVAILABLE_IN_ALL
 void         gtk_menu_button_set_icon_name (GtkMenuButton *menu_button,
                                             const char    *icon_name);